package com.baymax.study.redisson.infrastructure.exceptions;

import com.baymax.study.atomic.tools.ResultMsg;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author baymax
 * @since 2025-05-20
 */
@Slf4j
@RestControllerAdvice
public class RestExceptionHandler {
    @ExceptionHandler(Exception.class)
    public ResultMsg handleException(Exception exception) {
        log.error("occur exception", exception);
        String message = exception.getMessage();
        return ResultMsg.buildFailed(message);
    }
}
